/* Source file https://github.com/MrOtherGuy/firefox-csshacks/tree/master/chrome/click_selected_tab_to_focus_urlbar.css made available under Mozilla Public License v. 2.0
See the above repository for updates as well as full license text. */

/* Clicking selected tab selects focuses urlbar */
/* Selected tab cannot be normally clicked (right-,middle- or left-clicked) EXCEPT from the tab icon */

/* Clicking selected pinned tab doesn't focus urlbar by default since I expect you might not want to change pinned tab address - see below */


/* Make selected tab unclickable so click goes to the capture box, obviously it can't be clicked at all anymore */
/* remove the :not([pinned]) bit to make clicking pinned tab AROUND the tab-icon focus urlbar*/

.tabbrowser-tab:not([pinned])[selected]{ pointer-events: none }

:root{
  --uc-window-control-width: 138px;
  --uc-buttons-width: 116px;
  --uc-window-drag-space-width: 40px;
  --uc-menubar-height: 0px;
}
@media (-moz-platform: windows),
       (-moz-platform: linux){
  :root:is([sizemode="maximized"],[sizemode="fullscreen"]){
    --uc-window-drag-space-width: 0px;
  }
  #toolbar-menubar:is([autohide="false"],:not([autohide])) ~ #nav-bar{
    --uc-window-drag-space-width: 0px;
    --uc-menubar-height: 28px;
  }
}
/* Add back pointer-events to several elements so UI remains usable */
/* The selected tab can be clicked normally from the icon */
#TabsToolbar toolbarbutton,
#TabsToolbar toolbaritem,
.tabbrowser-tab,
.tab-close-button,
.tab-icon-stack{
  pointer-events: auto
}
/* Invisible capture box behind tabs*/
:root:not([customizing]) .urlbar-input-container::before{
  position: fixed;
  display: block;
  left: 0;
  top: var(--uc-menubar-height);
  width: var(--uc-buttons-width);
  height: calc(var(--tab-min-height) + 2*var(--tab-block-margin));
  content: "";
  pointer-events: auto;
}
:root[customtitlebar]:not([customizing]) .urlbar-input-container::before{
  left: var(--uc-window-drag-space-width);
  width: calc(100vw - var(--uc-window-control-width) - var(--uc-buttons-width) - 2 * var(--uc-window-drag-space-width));
}
.urlbar-input-container:focus-within::before{ display: none !important; }

/* Make tabs appear over the invisible box */
:root:not([customizing]) #TabsToolbar-customization-target{
  position: relative;
  z-index: 1;
  pointer-events: none
}
:root[customtitlebar] .browser-titlebar{
  opacity: 1 !important;
  will-change: unset !important;
  transition: none !important;
}